<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> 
<!DOCTYPE html>
<html lang="en">
<head>
<%
	String bathPath = request.getContextPath();
	pageContext.setAttribute("bathPath", bathPath);
%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>增加/修改部门</title>
<link rel="stylesheet" href="${bathPath}/frame/layui/css/layui.css">
<link rel="stylesheet" href="${bathPath}/frame/static/css/style.css">
<link rel="icon" href="${bathPath}/frame/static/image/code.png">
<link type="text/css" rel="stylesheet" href="${bathPath}/css/page.css"/>
<script type="text/javascript" src="${bathPath}/js/jquery-1.9.1.min.js" ></script>
<script type="text/javascript" src="${bathPath}/js/ajaxSessionOut.js" ></script>
<!-- 1    css资源 -->
<link rel="stylesheet" type="text/css" href="${bathPath}/js/jquery-easyui-1.4.2/themes/default/easyui.css">
<!-- 2    图标资源 -->
<link rel="stylesheet" type="text/css" href="${bathPath}/js/jquery-easyui-1.4.2/themes/icon.css"> 
<!-- 3    EasyUI的js包 -->
<script type="text/javascript" src="${bathPath}/js/jquery-easyui-1.4.2/jquery.easyui.min.js"></script>
<!-- 4    本地语言 -->
<script type="text/javascript" src="${bathPath}/js/jquery-easyui-1.4.2/locale/easyui-lang-zh_CN.js"></script>
<!-- layer -->
<link type="text/css" rel="stylesheet" href="${bathPath}/js/layer/skin/layer.css"/>
<script type="text/javascript" src="${bathPath}/js/layer/layer.js" ></script>
<!-- validation -->
<script type="text/javascript" src="${bathPath }/js/jquery-validation/jquery.validate.js"></script>

<script src="${bathPath }/js/quickui/libs/js/form/validationRule.js" type="text/javascript"></script>
<script src="${bathPath }/js/quickui/libs/js/form/validation.js" type="text/javascript"></script>
<script src="${bathPath}/frame/layui/layui.js" charset="utf-8"></script>
<style type="text/css">
.my-skin .layui-layer-btn a {
	background-color:#009688;
	}

</style>
<script type="text/javascript">
$(function(){
	$(".datagrid-header-rownumber").html("序号"); //给第一列设置标题
	
	//验证名称唯一性
	$("#netgroupname").blur(
		function(){
			var netgroupname = document.getElementById('netgroupname').value;
			//alert("进入keyup");
			$.ajax({
				type:"POST",
				async:true,
				url:"${bathPath}/aDKNetGroup/checkSname.action",
				data : {"netgroupname":netgroupname},
				success:function(data){
						if(data!=0){
							top.layer.msg("名称已存在");
						}
					}
				});
	});
}); 

function search(){
	var ngName=document.getElementById("netgroupname").value;//页面上输入的name
	//alert("叨叨+"+ngName);
	if(ngName=="" || ngName==null){	
		top.layer.msg("名称不能为空");
		//parent.layer.close(parent.layer.index);
		}else{
			var param=$("form").serialize();
			$.ajax({
				type:"POST",
			    url:"${bathPath}/aDKNetGroup/insertNetGroup.action", 
			    data: param,
			    success: function(data){
			    	layer.confirm("保存成功！", {btn: ['确定'], title: "提示",skin:"my-skin"}, function(){
			   		parent.layer.close(parent.layer.index);
			   		parent.location.reload();
			   		});
			   	}
			});
			parent.layer.close(parent.layer.index);
		}
	}

function isSubmit(){
	var sum = 0;
	var box = $(".validatebox-text");
	for(var i=0;i<box.length;i++){
		if(!$(box[i]).validatebox("isValid")){
			sum++;
		}
	}
	if(sum>0){
		return false;
	}else{
		return true;	
	}
}
layui.use('form', function(){
	  var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
	  //alert("${zuzhi.netgroupid}");
	  if("${zuzhi.keyword}"==0){
	     $("input[type=radio][name=keyword][value=0]").attr("checked",'checked');
     }else{
	     $("input[type=radio][name=keyword][value=1]").attr("checked",'checked');
     }
	  
	  //……
	  //但是，如果你的HTML是动态生成的，自动渲染就会失效
	  //因此你需要在相应的地方，执行下述方法来手动渲染，跟这类似的还有 element.init();

	  form.render();
});
</script>
</head>
<body class="body">
<form class="layui-form layui-form-pane" action="" showOnMouseOver="false" id="myform">
	<input type="hidden" name="netgroupid" value="${zuzhi.netgroupid}" >
	<table class="param_table">
		<tr>
			<td style="width:250px; padding:3px;">
				<div class="layui-form-item">
       				<label class="layui-form-label" style="width:130px;">组织机构名称：</label>
       			<div class="layui-input-inline">
            			<input type="text" id="netgroupname" name="netgroupname" placeholder="请输入" value="${zuzhi.netgroupname}" lay-verify="" autocomplete="off" class="layui-input">
            			<%-- <input type="text" id="netgroupname" name="netgroupname" placeholder="请输入" value="${zuzhi.netgroupname}" lay-verify="required|netgroupname" autocomplete="off" class="layui-input"> --%>
            		</div>
            	</div>
            </td>
		</tr>
		<tr >
			<td style="width:250px; padding:3px;">
				<div class="layui-form-item">
       				<label class="layui-form-label" style="width:130px;">是否是公共组织：</label>
       				<div class="layui-input-inline">
            			<input type="radio" id="shikeyword" name="keyword" value="0" title="是" lay-filter="jiedian" />
           		 		<input type="radio" id="foukeyword" name="keyword" value="1" title="否" checked ="" lay-filter="jiedian" />
            		</div>
            	</div>
            </td>
		</tr>
		<tr >
			<td style="width:250px; padding:3px;">
				<div class="layui-form-item">
       				<label class="layui-form-label" style="width:320px;text-algin:left;">备注：</label>
       				<br/>
       				<br/>
       				<div class="layui-input-inline" style="width:320px;">
            			<textarea id="netgroupremark" name="netgroupremark" placeholder="请输入内容" class="layui-textarea" > ${zuzhi.netgroupremark}</textarea>
            		</div>
            	</div>
            </td>
		</tr>
   </table>
   
   <div class="layui-form-item">
        <!-- <button class="layui-btn site-demo-active layui-btn-sm" data-method="offset" lay-submit="" lay-filter="sub" style="margin-left:310px;" onblur="return search();">保 存</button> -->
        <button class="layui-btn site-demo-active layui-btn-sm" data-method="offset" lay-submit="" lay-filter="sub" style="margin-left:310px;" onclick="search()">保 存</button>
    </div>
</form>
</body>
</html>